import { View } from '@tarojs/components';
import './index.less';
import { IUser } from '@/types/user';
import Taro from '@tarojs/taro';

interface IProps {
  user:IUser
}

export default function Index(props: IProps) {
  const { user } = props;

  if(!user?.id) {
    return <View className="user-mask">
      <View className="user-mask-content">
        <View className="user-mask-content-title">
          请先登录
        </View>
        <View className="user-mask-content-button" onClick={() => {
          Taro.navigateTo({
            url: '/pages/login/index',
          });
        }}>
          登录
        </View>
      </View>
    </View>;
  }

  return null;
}
